package offer

import (
	// "bp/cache"
	"bp/conf"
	"bp/db"
	"bp/db/sqlc/ctype"
	"bp/internal/service/entity"
	"go.uber.org/zap"
	"time"
)

type OfferComServiceImp struct {
	dao       *db.PgDao
	slog      *zap.SugaredLogger
	vars      *conf.VarsSection
	entityHub *entity.EntityHub
}

// New initialization
func New(
	pgdao *db.PgDao,
	slog *zap.SugaredLogger,
	vars *conf.VarsSection,
	entityHub *entity.EntityHub,
) *OfferComServiceImp {
	return &OfferComServiceImp{
		dao:       pgdao,
		slog:      slog.With("module", "OfferComService"),
		vars:      vars,
		entityHub: entityHub,
	}
}

// 优惠项
type Offer struct {
	ID                      int64
	Name                    string
	Desc                    string
	Tags                    []string
	Nature                  string
	OfferCategory           string
	OfferType               string
	NeedVerifyQualification bool
	QualifyTypes            []string
	Price                   int32
	Quota                   int32
	OffMaximum              int32
	GradientRules           ctype.OffGradientRuleArray
	UsePeriodType           string
	Days                    int32
	AvailableAfterGotDays   int32
	Begined                 time.Time
	Ended                   time.Time
}

// OffItemInfo 优惠项目信息(简,供外部使用)
type OffItemInfo struct {
	Name string `json:"name"`
	Desc string `json:"desc"`
}